#!/usr/bin/env python
# encoding: utf-8
"""
@summary: 计算domain的reducer
@author: hongxingfan
@since: 2014年8月15日    上午10:42:40
"""
import sys

if __name__ == "__main__":
    result_hash = {}
    
    totalPv = 0  # 全部PV
    totalUv_set = set([])  # suv
    
    for line in sys.stdin:
        line = line.strip()
        cols = line.split("\t")
        
        domain = cols[0]
        pv = float(cols[1])
        suv = cols[2]
        
        totalPv += pv
        totalUv_set.add(suv)
        
        if domain in result_hash:
            values = result_hash.get(domain)
            values[0] += pv
            values[1].add(suv)
        else:
            result_hash[domain] = [pv, set([suv])]
    # 输出
    print("%s\t%d\t%d" % ("整体情况", totalPv, len(totalUv_set)))        
   
    for (k, v) in sorted(result_hash.items(), key = lambda d:d[1], reverse = True):  # 字典排序
        if v[0] >= 10000:
            print("%s\t%d\t%d" % (k, v[0], len(v[1])))
